package virtual;

import android.app.Application;
import android.content.Context;

import com.lody.virtual.client.core.VirtualCore;

import java.io.IOException;

import virtual.disk.DiskLruCacheHelper;

public class Virtuals {
    public static Application VirtualApplication;



    public static void initVirtual(Application application) {
        VirtualApplication = application;
        VirtualCore virtualCore = VirtualCore.get();
        virtualCore.initialize(new VirtualCore.VirtualInitializer() {

            @Override
            public void onMainProcess() {
            }

            @Override
            public void onVirtualProcess() {
            }

            @Override
            public void onServerProcess() {
            }
        });
    }

    public static Application getVirtualApplication() {
        return VirtualApplication;
    }
    public static DiskLruCacheHelper diskLruCacheHelper;
    /***
     * 文件缓存
     * @param Context
     * @throws IOException
     */
    public static void initDiskLruCacheHelper(Context Context) throws IOException {
        diskLruCacheHelper = new DiskLruCacheHelper(Context);
    }
    public static DiskLruCacheHelper getDiskLruCacheHelper(){
        return diskLruCacheHelper;
    }


    public static void attachBaseDiskLruCacheHelper(Context base) {
        try {
            initDiskLruCacheHelper(base);
        } catch (IOException e) {
            e.getMessage();
        }

    }
}
